package com.deyuanyun.pic.ae.controller.dto;

import com.deyuanyun.pic.ae.domain.GeologicHazard;
import com.deyuanyun.pic.ae.domain.PressObject;
import com.deyuanyun.pic.common.util.DateUtil;
import com.deyuanyun.pic.common.util.NumberUtil;
import com.deyuanyun.pic.common.util.StringUtils;

import java.math.BigDecimal;
import java.util.Date;

/**
 * “管道沿线地质灾害信息” 查询条件 数据传输对象
 *
 * 方法详情：<br/>
 *
 * @author huanglw
 * @date  2017-1-5
 *
 * History: [修改人][时间][修改描述]
 */
public class GeologicHazardEdit extends AEBaseEdit<GeologicHazard> {

    // 管道编号
    private String pipeLineId;
    // 类型AE_GEOLOGIC_HAZARD_TYPE（粘土滑坡、碎石土滑坡、黄土滑坡、岩体滑坡、崩塌、泥石流、采空区塌陷、坡面水毁、河沟道水毁、台田地水毁、黄土湿陷、盐渍土、冻土、岩溶塌陷、地面沉降、地裂缝、地震液化、水化学腐蚀、人类工程活动）
    private String type;
    // 风险概率分值
    private String riskProbabilityScore;
    // 风险概率分级
    private String riskProbabilityLevel;
    // 起点X
    private BigDecimal beginX;
    // 起点Y
    private BigDecimal beginY;
    // 起点Z
    private BigDecimal beginZ;
    // (填写)平行起点_附近测试桩pic_pipe_identification.ID_
    private String beginNagmInput;
    // (填写)平行起点_附近测试桩距离（相对值）
    private BigDecimal beginNagmMileageInput;
    // 终点X
    private BigDecimal endX;
    // 终点Y
    private BigDecimal endY;
    // 终点Z
    private BigDecimal endZ;
    // (填写)平行段终点_附近测试桩pic_pipe_identification.ID_
    private String endNagmInput;
    // (填写)平行段终点_附近测试桩距离（相对值）
    private BigDecimal endNagmMileageInput;
    // 平行长度（m）
    private BigDecimal parallelLength;
    // 位置描述
    private String locationDescription;
    // 后果分级
    private String consequenceLevel;
    // 风险等级（高、中高、中、中低、低、未知）
    private String riskLevel;

    public String getPipeLineId() {
        return pipeLineId;
    }

    public void setPipeLineId(String pipeLineId) {
        this.pipeLineId = pipeLineId;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getRiskProbabilityScore() {
        return riskProbabilityScore;
    }

    public void setRiskProbabilityScore(String riskProbabilityScore) {
        this.riskProbabilityScore = riskProbabilityScore;
    }

    public String getRiskProbabilityLevel() {
        return riskProbabilityLevel;
    }

    public void setRiskProbabilityLevel(String riskProbabilityLevel) {
        this.riskProbabilityLevel = riskProbabilityLevel;
    }

    public BigDecimal getBeginX() {
        return beginX;
    }

    public void setBeginX(BigDecimal beginX) {
        this.beginX = beginX;
    }

    public BigDecimal getBeginY() {
        return beginY;
    }

    public void setBeginY(BigDecimal beginY) {
        this.beginY = beginY;
    }

    public BigDecimal getBeginZ() {
        return beginZ;
    }

    public void setBeginZ(BigDecimal beginZ) {
        this.beginZ = beginZ;
    }

    public String getBeginNagmInput() {
        return beginNagmInput;
    }

    public void setBeginNagmInput(String beginNagmInput) {
        this.beginNagmInput = beginNagmInput;
    }

    public BigDecimal getBeginNagmMileageInput() {
        return beginNagmMileageInput;
    }

    public void setBeginNagmMileageInput(BigDecimal beginNagmMileageInput) {
        this.beginNagmMileageInput = beginNagmMileageInput;
    }

    public BigDecimal getEndX() {
        return endX;
    }

    public void setEndX(BigDecimal endX) {
        this.endX = endX;
    }

    public BigDecimal getEndY() {
        return endY;
    }

    public void setEndY(BigDecimal endY) {
        this.endY = endY;
    }

    public BigDecimal getEndZ() {
        return endZ;
    }

    public void setEndZ(BigDecimal endZ) {
        this.endZ = endZ;
    }

    public String getEndNagmInput() {
        return endNagmInput;
    }

    public void setEndNagmInput(String endNagmInput) {
        this.endNagmInput = endNagmInput;
    }

    public BigDecimal getEndNagmMileageInput() {
        return endNagmMileageInput;
    }

    public void setEndNagmMileageInput(BigDecimal endNagmMileageInput) {
        this.endNagmMileageInput = endNagmMileageInput;
    }

    public BigDecimal getParallelLength() {
        return parallelLength;
    }

    public void setParallelLength(BigDecimal parallelLength) {
        this.parallelLength = parallelLength;
    }

    public String getLocationDescription() {
        return locationDescription;
    }

    public void setLocationDescription(String locationDescription) {
        this.locationDescription = locationDescription;
    }

    public String getConsequenceLevel() {
        return consequenceLevel;
    }

    public void setConsequenceLevel(String consequenceLevel) {
        this.consequenceLevel = consequenceLevel;
    }

    public String getRiskLevel() {
        return riskLevel;
    }

    public void setRiskLevel(String riskLevel) {
        this.riskLevel = riskLevel;
    }

    @Override
    public void fromDomain(GeologicHazard domain) {

        // 管道编号
        this.pipeLineId = domain.getPipeLineId();
        // 类型AE_GEOLOGIC_HAZARD_TYPE（粘土滑坡、碎石土滑坡、黄土滑坡、岩体滑坡、崩塌、泥石流、采空区塌陷、坡面水毁、河沟道水毁、台田地水毁、黄土湿陷、盐渍土、冻土、岩溶塌陷、地面沉降、地裂缝、地震液化、水化学腐蚀、人类工程活动）
        this.type = domain.getType();
        // 风险概率分值
        this.riskProbabilityScore = domain.getRiskProbabilityScore();
        // 风险概率分级
        this.riskProbabilityLevel = domain.getRiskProbabilityLevel();
        // 起点X
        this.beginX = domain.getBeginX();
        // 起点Y
        this.beginY = domain.getBeginY();
        // 起点Z
        this.beginZ = domain.getBeginZ();
        // (填写)平行起点_附近测试桩pic_pipe_identification.ID_
        this.beginNagmInput = StringUtils.isNotNullEmpty(domain.getBeginNagmNumberInput()) ? domain.getBeginNagmNumberInput() : domain.getBeginNagmNumber();;
        // (填写)平行起点_附近测试桩距离（相对值）
        this.beginNagmMileageInput = NumberUtil.toMeter(StringUtils.isNotNullEmpty(domain.getBeginNagmNumberInput()) ? domain.getBeginNagmMileageInput() : domain.getBeginNagmMileage());;
        // 终点X
        this.endX = domain.getEndX();
        // 终点Y
        this.endY = domain.getEndY();
        // 终点Z
        this.endZ = domain.getEndZ();
        // (填写)平行段终点_附近测试桩pic_pipe_identification.ID_
        this.endNagmInput = StringUtils.isNotNullEmpty(domain.getEndNagmNumberInput()) ? domain.getEndNagmNumberInput() : domain.getEndNagmNumber();;;
        // (填写)平行段终点_附近测试桩距离（相对值）
        this.endNagmMileageInput = NumberUtil.toMeter(StringUtils.isNotNullEmpty(domain.getEndNagmNumberInput()) ? domain.getEndNagmMileageInput() : domain.getEndNagmMileage());;;
        // 平行长度（m）
        this. parallelLength = domain.getParallelLength();
        // 位置描述
        this.locationDescription = domain.getLocationDescription();
        // 后果分级
        this.consequenceLevel = domain.getConsequenceLevel();
        // 风险等级（高、中高、中、中低、低、未知）
        this.riskLevel = domain.getRiskLevel();

        super.fromDomain(domain.getId(), domain.getRecorder(), domain.getRecordTime(), domain.getRemarks());
    }

    @Override
    public GeologicHazard toDomain() {

        GeologicHazard geologicHazard = new GeologicHazard();
        // 管道编号
        geologicHazard.setPipeLineId(this.pipeLineId);
        // 类型AE_GEOLOGIC_HAZARD_TYPE（粘土滑坡、碎石土滑坡、黄土滑坡、岩体滑坡、崩塌、泥石流、采空区塌陷、坡面水毁、河沟道水毁、台田地水毁、黄土湿陷、盐渍土、冻土、岩溶塌陷、地面沉降、地裂缝、地震液化、水化学腐蚀、人类工程活动）
        geologicHazard.setType(this.type);
        // 风险概率分值
        geologicHazard.setRiskProbabilityScore(this.riskProbabilityScore);
        // 风险概率分级
        geologicHazard.setRiskProbabilityLevel(this.riskProbabilityLevel);
        // 起点X
        geologicHazard.setBeginX(this.beginX);
        // 起点Y
        geologicHazard.setBeginY(this.beginY);
        // 起点Z
        geologicHazard.setBeginZ(this.beginZ);
        // (填写)平行起点_附近测试桩pic_pipe_identification.ID_
        geologicHazard.setBeginNagmInput(this.beginNagmInput);
        // (填写)平行起点_附近测试桩距离（相对值）
        geologicHazard.setBeginNagmMileageInput(NumberUtil.toMillimeter(this.beginNagmMileageInput));
        // 终点X
        geologicHazard.setEndX(this.endX);
        // 终点Y
        geologicHazard.setEndY(this.endY);
        // 终点Z
        geologicHazard.setEndZ(this.endZ);
        // (填写)平行段终点_附近测试桩pic_pipe_identification.ID_
        geologicHazard.setEndNagmInput(this.endNagmInput);
        // (填写)平行段终点_附近测试桩距离（相对值）
        geologicHazard.setEndNagmMileageInput(NumberUtil.toMillimeter(this.endNagmMileageInput));
        // 平行长度（m）
        geologicHazard.setParallelLength(this.parallelLength);
        // 位置描述
        geologicHazard.setLocationDescription(this.locationDescription);
        // 后果分级
        geologicHazard.setConsequenceLevel(this.consequenceLevel);
        // 风险等级（高、中高、中、中低、低、未知）
        geologicHazard.setRiskLevel(this.riskLevel);

        // id
        geologicHazard.setId(this.getId());
        // 记录人
        geologicHazard.setRecorder(this.getRecorder());
        // 记录时间
        Date recordTimeTemp = null;
        try {
            recordTimeTemp = DateUtil.allStr2Date(this.getRecordTime());
        } catch (Exception e) {
            e.printStackTrace();
        }
        geologicHazard.setRecordTime(recordTimeTemp);
        // 备注
        geologicHazard.setRemarks(this.getRemarks());

        return geologicHazard;
    }
}
